package com.training.action.xixiaoming;

import java.util.List;

import com.training.pojo.chengshu.MotorRoom;
import com.training.service.xixiaoming.motorService;

public class showDeleMotorAction {


	
	private motorService motorser;
	List<MotorRoom> listmotor;
	private static final Integer MAX = 3;
	private Integer page = 1;
	private Integer totalPages;
	
	public String execute(){
		System.out.println("shwoEditMotorAction");
		int rowCount = motorser.getRowCount();
		totalPages = ((rowCount % MAX) == 0)?(rowCount/MAX):(rowCount/MAX + 1);
		if(page < 1){
			page = 1;
		}
		if(page > totalPages){
			page = totalPages;
		}
		int start = (page - 1) * MAX+1;
		listmotor=motorser.listMotor(start,MAX);
		return "success";
	}

	public List<MotorRoom> getListmotor() {
		return listmotor;
	}

	public void setListmotor(List<MotorRoom> listmotor) {
		this.listmotor = listmotor;
	}

	public motorService getMotorser() {
		return motorser;
	}

	public void setMotorser(motorService motorser) {
		this.motorser = motorser;
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getTotalPages() {
		return totalPages;
	}

	public void setTotalPages(Integer totalPages) {
		this.totalPages = totalPages;
	}

	public static Integer getMax() {
		return MAX;
	}
}
